<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <title>my first export PDF</title>
    <style type="text/css" media="print">
        @page rotated {
            size: landscape;
        }
    </style>
</head>

<body>
    <script src="../makepdf/pdfmake.min.js"></script>
    <script src="../makepdf/vfs_fonts.js"></script>
    <script>
        var temp_name = window.location.search;
        var name = temp_name.split("=")[1];
        var name_decode = decodeURI(name);
        function down(name) {
            var dd = {
                content: [
                    { text: "宁夏水投中源水务分公司安装抢修派工单", style: 'mainHead' },
                    {
                        style: "table",
                        color: "#333",
                        table: {
                            headerRows: 1,
                            widths: [60, 'auto', '*', 60, 'auto', 'auto', 40],
                            heights: 25,
                            body: [
                                [
                                    {
                                        text: "日期",
                                        style:"margin"
                                    },
                                    {
                                        text: "时间",
                                        colSpan: 2,
                                        style:"margin"
                                    },
                                    {

                                    },
                                    {
                                        text: "用户名",
                                        style:"margin"

                                    },
                                    {
                                        text: "用户名",
                                        colSpan: 3,
                                        style:"margin"

                                    },
                                    {

                                    },
                                    {

                                    }
                                ],
                                [
                                    {
                                        text: "紧急程度",
                                        style:"margin"

                                    },
                                    {
                                        text: "紧急程度",
                                        colSpan: 2,
                                        style:"margin"

                                    },
                                    {

                                    },
                                    {
                                        text: "联系电话",
                                        style:"margin"

                                    },
                                    {
                                        text: "电话号码",
                                        colSpan: 3,
                                        style:"margin"

                                    },
                                    {

                                    },
                                    {

                                    }
                                ],
                                [
                                    {
                                        text: "出勤事由",
                                        style:"margin"

                                    },
                                    {
                                        text: "出勤事由",
                                        colSpan: 2,
                                        style:"margin"

                                    },
                                    {

                                    },
                                    {
                                        text: "处理人",
                                        style:"margin"


                                    },
                                    {
                                        text: "处理人",
                                        colSpan: 3,
                                        style:"margin"

                                    },
                                    {

                                    },
                                    {

                                    }
                                ],
                                [
                                    {
                                        text: "工程情况",
                                        rowSpan: 3,
                                        style:"marginCenter"

                                    },
                                    {
                                        text: "序号",
                                        style:"margin"

                                    },
                                    {
                                        text: "工作内容",
                                        style:"margin"

                                    },
                                    {
                                        text: "材料名称",
                                        style:"margin"

                                    },
                                    {
                                        text: "单位",
                                        style:"margin"

                                    },
                                    {
                                        text: "数量",
                                        style:"margin"

                                    },
                                    {
                                        text: "备注",
                                        style:"margin"

                                    }
                                ],
                                [
                                    {
                                    },
                                    {
                                        text: "1",
                                        style:"margin"
                                    },
                                    {
                                        text: "工作内容",
                                        style:"margin"

                                    },
                                    {
                                        text: "材料名称",
                                        style:"margin"
                                    },
                                    {
                                        text: "单位",
                                        style:"margin"

                                    },
                                    {
                                        text: "数量",
                                        style:"margin"
                                    },
                                    {
                                        text: "备注",
                                        style:"margin"
                                    }
                                ],
                                [
                                    {
                                    },
                                    {
                                        text: "2",
                                        style:"margin"
                                    },
                                    {
                                        text: "工作内容",
                                        style:"margin"
                                    },
                                    {
                                        text: "材料名称",
                                        style:"margin"
                                    },
                                    {
                                        text: "单位",
                                        style:"margin"
                                    },
                                    {
                                        text: "数量",
                                        style:"margin"
                                    },
                                    {
                                        text: "备注",
                                        style:"margin"
                                    }
                                ],
                                [
                                    {
                                        text: "处理结果",
                                        style:"margin"
                                    },
                                    {
                                        text: "处理结果",
                                        colSpan: 2,
                                        style:"margin"
                                    },
                                    {

                                    },
                                    {
                                        text: "处理时间",
                                        style:"margin"
                                    },
                                    {
                                        text: "处理时间",
                                        colSpan: 3,
                                        style:"margin"
                                    },
                                    {

                                    },
                                    {

                                    }
                                ],
                                [
                                    {
                                        text: "库存",
                                        style:"margin"
                                    },
                                    {
                                        text: "库存",
                                        colSpan: 2,
                                        style:"margin"
                                    },
                                    {

                                    },
                                    {
                                        text: "部门负责人",
                                        style:"margin"
                                    },
                                    {
                                        text: "部门负责人",
                                        colSpan: 3,
                                        style:"margin"
                                    },
                                    {

                                    },
                                    {

                                    }
                                ],
                                [
                                    {
                                        text: "派工负责人",
                                        style:"margin"
                                    },
                                    {
                                        text: "派工负责人",
                                        colSpan: 2,
                                        style:"margin"
                                    },
                                    {

                                    },
                                    {
                                        text: "审核人",
                                        style:"margin"

                                    },
                                    {
                                        text: "审核人",
                                        colSpan: 3,
                                        style:"margin"
                                    },
                                    {

                                    },
                                    {

                                    }
                                ]
                            ]
                        }
                    }
                ],
                defaultStyle: {
                    font: '方正姚体'
                },
                styles: {
                    mainHead: {
                        alignment: "center",
                        fontSize: 18,
                        bold: true,
                        margin: [0, 0, 0,20]
                    },
                    table: {
                        fontSize:12,
                        alignment:"center"
                    },
                    margin:{
                        margin:[0,5,0,0]
                    },
                    marginCenter:{
                        margin:[0,35,0,0]
                    }
                }
            };
            pdfMake.fonts = {
                Roboto: {
                    normal: 'Roboto-Regular.ttf',
                    bold: 'Roboto-Medium.ttf',
                    italics: 'Roboto-Italic.ttf',
                    bolditalics: 'Roboto-Italic.ttf'
                },
                方正姚体: {
                    normal: 'FZYTK.TTF',
                    bold: 'FZYTK.TTF',
                    italics: 'FZYTK.TTF',
                    bolditalics: 'FZYTK.TTF',
                }
            };

            pdfMake.createPdf(dd).download(name_decode + '.pdf');
        }
        window.onload = function () {
            down(name);
        }
    </script>
</body>

</html>